<form method="post" enctype="multipart/form-data" target="_blank" id="goods_list_form">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead> 
            <tr>
                <td style="width: 1px;" class="text-center">
                </td>                
                <td class="text-right">
                    <a href="javascript:sort('goods_id');">ID</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('goods_name');">商品名称</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('sales_sum');">销量</a>
                </td>
				<!-- <td class="text-left">
                    实际销量
                </td> -->
                <td class="text-left">
                    <a href="javascript:sort('points');">扣点比例</a>
                </td>                                
                <td class="text-left">
                    <a href="javascript:;">店铺名</a>
                </td>
				<td class="text-left">
				    <a href="javascript:sort('shop_price');">所属分类</a>
				</td>
                <td class="text-left">
                    <a href="javascript:sort('shop_price');">价格</a>
                </td>
				<?php
				if($_SESSION['role_id']==1 || $_SESSION['role_id']==20 || $_SESSION['role_id']==329){
				?>
                <td class="text-center">
                    <a href="javascript:sort('is_recommend');">推荐</a>
                </td>
                <td class="text-center">
                    <a href="javascript:sort('is_new');">品牌</a>
                </td>   
                <td class="text-center">
                    <a href="javascript:sort('is_hot');">人气</a>
                </td>
				<td class="text-center">
				    <a href="javascript:sort('is_yanzhi');">特推好货</a>
				</td>
				<td class="text-center">
				    <a href="javascript:sort('is_qc');">清仓特卖</a>
				</td>
				<?php
				}
				?>
				<td class="text-left">
				    <a href="javascript:sort('store_count');">库存</a>
				</td> 
				<td class="text-left">
				    <a href="javascript:sort('jifen_price');">积分</a>
				</td>
               <td class="text-left">
                    <a  href="javascript:sort('sorts');">排序(越小越前)</a>
                </td>
                <td class="text-left">
                    <a  href="javascript:sort('yanzhi_sort');">特推好货排序(越小越前)</a>
                </td>
                <td class="text-center">
                    <a href="javascript:sort('is_on_sale');">上/下架</a>
                </td>
                <td class="text-center">
                    <a href="javascript:sort('p_status');">排行榜</a>
                </td>
                <!-- <td class="text-center">-->
                <!--    <a href="javascript:sort('p_status');">排行榜</a>-->
                <!--</td>-->
                <td class="text-left">
                    <a href="javascript:sort('prom_lock');">状态</a>
                </td>
				<td class="text-center">
                    上架时间
                </td>
				<td class="text-left">
                    <a href="javascript:sort('goods_state');">操作</a>
                </td>  
            </tr>
            </thead>
            <tbody>
            <volist name="goodsList" id="list">
                <tr>
                    <td class="text-center">
                       <input type="checkbox" name="goods_id[]" value="{$list.goods_id}"/>
                    </td>
                    <td class="text-right">{$list.goods_id}</td>
                    <td class="text-left"><img src="{$list.original_img}" height="50" style="cursor: pointer;" onmouseover="layer.tips('<img src={$list.original_img} width=180>',this,{tips: [1, '#EAF8FF']});" onmouseout="layer.closeAll();">  <span onmouseover="layer.tips('关键词:{$list.keywords}',this,{tips: [1, '#000']});" onmouseout="layer.closeAll();">{$list.goods_name|getSubstr=0,33}</span></td>
					<td class="text-center">{$list.sales_sum}</td>
					<!-- <td class="text-center">{$list.sale_read}</td> -->
                    <td class="text-left">
						<?php
							if(session('fenbu_id')==0){
						?>
						<!--<input type="text" onchange="updateSort('goods','goods_id','{$list.goods_id}','points',this)"  onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" maxlength="3" value="{$list.points}" class="input-sm" style="width: 50px;text-align: center;" />-->
						<input type="text" onchange="updateSort('goods','goods_id','{$list.goods_id}','points',this)"  value="{$list.points}" class="input-sm" style="width: 50px;text-align: center;" />
						<?php
						}else{
							echo $list['points'];
						}
						?>
						%
						</td>
                    <td class="text-left"><a href="/index.php/Seller/Admin/login/store_id/{$list.store_id}" target="_blank" title="进入商家后台">{$list.store_name}</a></td>
					<td class="text-left">{$list.goods_type_name}</td>
                    <td class="text-left">{$list.shop_price}</td>
					<?php
					if($_SESSION['role_id']==1 || $_SESSION['role_id']==20 || $_SESSION['role_id']==329){
					?>
                    <td class="text-center">
                        <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_recommend] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_recommend',this)"/>
                    </td>
                    <td class="text-center">
                        <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_new] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_new',this)"/>
                    </td>
                    <td class="text-center">
                        <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_hot] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_hot',this)"/>
                    </td>
					<td class="text-center">
					    <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_yanzhi] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_yanzhi',this)"/>
					</td>
					<td class="text-center">
					    <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_qc] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_qc',this)"/>
					</td>
					<?php 
					}
					?>
					<td class="text-left">{$list.store_count}</td>
					<td class="text-left"><input type="text" onchange="updateSort('goods','goods_id','{$list.goods_id}','jifen_price',this)"  onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" maxlength="3" value="{$list.jifen_price}" class="input-sm" style="width: 50px;text-align: center;" /></td>
                    <td class="text-left"><input type="text" onchange="updateSort('goods','goods_id','{$list.goods_id}','sorts',this)"  onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" maxlength="3" value="{$list.sorts}" class="input-sm" style="width: 50px;text-align: center;" /></td>
                    <td class="text-left"><input type="text" onchange="updateSort('goods','goods_id','{$list.goods_id}','yanzhi_sort',this)"  onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" maxlength="3" value="{$list.yanzhi_sort}" class="input-sm" style="width: 50px;text-align: center;" /></td>
                    <td class="text-center">
<img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_on_sale] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_on_sale',this)"/>
                    </td>
                    <td class="text-center">
<img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[prom_lock] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','prom_lock',this)"/>
                    </td>
 <td class="text-left">
	 <span onmouseover="layer.tips('{$list.zhuangtai}',this,{tips: [1, '#000']});" onmouseout="layer.closeAll();">
 <if condition="$list[goods_state] eq 0">待审核</if>
 <if condition="$list[goods_state] eq 1">审核通过</if>
 <if condition="$list[goods_state] eq 2">审核失败</if>
 <if condition="$list[goods_state] eq 3">违规下架</if>
 </span>
 </td>
  <td class="text-left">
	  {$list.on_time|date='Y-m-d H:i:s',###}
  </td>
  <td class="text-left">
	  <a href="javascript:;" rel="/index.php/Seller/Goods/addEditGoods/goods_id/{$list.goods_id}" rev="{$list.store_id}" data-toggle="tooltip" id="xiugai" class="btn btn-primary" data-original-title="修改"><i class="fa fa-pencil"> 修改</i></a>
	  <a href="javascript:;" onclick="fenbuKuncun('{$list.goods_id}')"   class="btn btn-primary" data-original-title="修改分部库存排序"><i class="fa fa-pencil"> 修改分部排序</i></a>
	  <a href="javascript:;" onclick="fenbukoudian('{$list.goods_id}')"   class="btn btn-primary" data-original-title="修改分部扣点"><i class="fa fa-pencil"> 修改分部扣点</i></a>
  </td>
                </tr>
            </volist>
            </tbody>
        </table>
    </div>
</form>
<div class="row">
    <div class="navbar-form form-inline">
        全选
        <input type="checkbox" onclick="$('input[name=\'goods_id\[\]\']').prop('checked', this.checked);">
        <div class="form-group">
            <select id="func_id" class="form-control" style="width: 120px;" onchange="fuc_change(this);">
                <option value="-1">请选择...</option>
                <option value="0">推荐</option>
                <option value="1">新品</option>
                <option value="2">热卖</option>
                <option value="3">审核商品</option>
            </select>
        </div>
        <div class="form-group" id="state_div" >
            <select id="state_id" class="form-control" style="display: none" onchange="state_change(this);">
                <option value="">请选择...</option>
                <foreach name="goods_state" item="vo" >
                    <option value="{$key}">{$goods_state[$key]}</option>
                </foreach>
            </select>
        </div>
        <button id="act_button" type="button" onclick="act_submit();" class="btn btn-primary disabled"><i class="fa"></i> 确定</button>
    </div>
    <div class="col-sm-9 text-right">{$page}</div>
</div>
<script>
    // 点击分页触发的事件   
	$(".pagination  a").click(function(){
        cur_page = $(this).data('p');
        ajax_get_table('search-form2',cur_page);
    });
	
    $(".table-responsive #xiugai").click(function(){
		var myrel=$(this).attr('rel');
		var store_id=$(this).attr('rev');
		var myrul='/index.php/Seller/Admin/login/store_id/'+store_id;//+myrel;
		$.get(myrul,function(e){
			layer.open({
			  type: 2,
			  shadeClose: true, //点击遮罩关闭
			  title:'商家产品信息',
			  skin: 'layui-layer-rim', //加上边框
			  area: ['920px', '620px'], //宽高
			  content: myrel
			});
		})
    });
	
	$(".table #picshow").click(function(){
		var mypic=$(this).attr('src');
		  layer.photos({
		    photos: {
				  "data": [
					{
					  "alt": "产品主图",
					  "src": mypic,
					}],
					}
		    ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机
		  });
	});
	
	function fenbuKuncun(goods_id){
	    layer.open({
			  type: 2,
			  shadeClose: true, //点击遮罩关闭
			  title:'分部库存和排序',
			  skin: 'layui-layer-rim', //加上边框
			  area: ['920px', '620px'], //宽高
			  content: '{:U('Admin/Goods/fenbuKuncun')}?goods_id='+goods_id
			});
	}
	function fenbukoudian(goods_id){
	    layer.open({
			  type: 2,
			  shadeClose: true, //点击遮罩关闭
			  title:'分部扣点设置',
			  skin: 'layui-layer-rim', //加上边框
			  area: ['920px', '620px'], //宽高
			  content: '{:U('Admin/Goods/fenbukoudian')}?goods_id='+goods_id
			});
	}
</script>